/// <reference path="../Scripts/jquery-1.7.1.min.js" />
/// <reference path="../Scripts/knockout-2.1.0.js" />

var RegisterViewModel = function () 
	{
    var self = this;
	// put a property loop here
	self.UserName = ko.observable();
	self.Password = ko.observable();
	self.ConfirmPassword = ko.observable();
	self.Email = ko.observable();
	self.FirstName = ko.observable();
	self.LastName = ko.observable();
	self.Address = ko.observable();
	self.City = ko.observable();
	self.Region = ko.observable();
	self.PostalCode = ko.observable();
	self.OfficePhone = ko.observable();
	self.CellPhone = ko.observable();
	self.PasswordQuestion = ko.observable();
	self.PasswordAnswer = ko.observable();
	self.Title = ko.observable();


			
    
    self.RegisterList = ko.observableArray([]);
    self.setApplication = function (
			_UserName, _Password, _ConfirmPassword, _Email, _FirstName, _LastName, _Address, _City, _Region, _PostalCode, _OfficePhone, _CellPhone, _PasswordQuestion, _PasswordAnswer, _Title
	
	) {

		UserName = _UserName;
		Password = _Password;
		RememberMe = _RememberMe;
		ConfirmPassword = _ConfirmPassword;
		Email = _Email;
		FirstName = _FirstName;
		LastName = _LastName;
		Address = _Address;
		City = _City;
		Region = _Region;
		PostalCode = _PostalCode;
		OfficePhone = _OfficePhone;
		CellPhone = _CellPhone;
		PasswordQuestion = _PasswordQuestion;
		PasswordAnswer = _PasswordAnswer;
		Title = _Title;
			
        
    }; //  End of set procedure 

	self.Register = function () {

        //alert("We are in the Register ko function");
      
        var myData = ko.toJSON(this);
        jQuery.ajax({
            url: "/account/register/",
            type: 'post',
            data: myData,
            contentType: 'application/json',
            success: function (result) {
                location.href = "/";
            }
        });



    }; //End of add procedure

			

}; //End of view model






